<template>
	<view class="message">
		<unicloud-db v-slot:default="{data, loading, error, options}" collection="uni-id-base-order" >
			<view v-if="error">{{error.message}}</view>
			<view v-else class="right">
				<uni-list>
					<uni-list-item  v-for="item in rammend" :key="item._id" :title="item.title" :note="item.address+'-'+'赏金:'+item.total_fee" 
					 link rightText="详情"
					 clickable  @click="onClick(item._id)">
					 </uni-list-item>
				</uni-list>
			</view>
		</unicloud-db>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				rammend:[],
				
			}
		},
		methods: {
			onClick(_id){
				uni.navigateTo({
					url:'/pages/details/details?_id='+_id
				})
			}
		},
		onLoad(){
			const db = uniCloud.database() //代码块为cdb
			// 使用uni-clientDB
			db.collection('uni-id-base-order')
			  .where({ 
				status:1 //传统MongoDB写法，不是jql写法。实际开发中推荐使用jql写法
			  }).get()
			  .then((res)=>{
			   
				this.rammend=res.result.data
			  }).catch((err)=>{
			    console.log(err.code); // 打印错误码
			        console.log(err.message); // 打印错误内容
			  })
		}
	}
</script>

<style lang="scss">
.message{
	
	
	
}
</style>
